package com.whlilong.jxc.action;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchWindow;
import com.whlilong.jxc.service.editor.IEditorService;

public abstract class AbstractAction extends Action {
	protected IWorkbenchWindow window;

	public AbstractAction(IWorkbenchWindow window) {
		this.window = window;
	}

	public void run() {
		try {
			Object ieditorService = window.getActivePage().getActiveEditor();
			if(ieditorService instanceof IEditorService){
				doOperator((IEditorService)ieditorService);
			} 
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	abstract void doOperator(IEditorService ieditorService);
}
